package com.lcifn.spring.ioc.scan;

import java.beans.PropertyDescriptor;

import org.springframework.beans.BeansException;
import org.springframework.beans.PropertyValues;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;
import org.springframework.stereotype.Component;

//@Component
public class SimpleInstantiationAwareBeanPostProcessor implements InstantiationAwareBeanPostProcessor{

    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("SimpleInstantiationAwareBeanPostProcessor postProcessBeforeInitialization:" + beanName);
        return bean;
    }

    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("SimpleInstantiationAwareBeanPostProcessor postProcessAfterInitialization:" + beanName);
        return bean;
    }

    public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
        System.out.println("SimpleInstantiationAwareBeanPostProcessor postProcessBeforeInstantiation:" + beanName);
        return null;
    }

    public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {
        System.out.println("SimpleInstantiationAwareBeanPostProcessor postProcessAfterInstantiation:" + beanName);
        return true;
    }

    public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeansException {
        System.out.println("SimpleInstantiationAwareBeanPostProcessor " + beanName + " postProcessPropertyValues " + pvs);
        return pvs;
    }

}
